<!--
 * @Author: liyin 2179253556@qq.com
 * @Date: 2023-02-18 08:48:47
 * @LastEditors: liyin 2179253556@qq.com
 * @LastEditTime: 2023-02-18 10:07:54
 * @FilePath: \test\src\components\ClassMessage.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div class="class-message-box">
        <Card :border="0" :padbottom="0">
            <Title title="年级统计详情" style="margin-bottom:15px;"></Title>
            <van-row :gutter="15">
                <van-col :span="6" v-for="(item, index) in dateList" :key="index">
                    <Button @click="checkDateBtn(index)" size="mini" style="width:100%;border-radius: 2px;" row
                        :type="dateIndex == index ? 'primary' : 'default'">{{ item
                        }}</Button>
                </van-col>
            </van-row>
            <div class="select-content-box">
                <ChangeSelect :firstName="facultyName" :secondName="gradeName" :thirdName="className"
                    :firstShow="facultyShow" :secondShow="gradeShow" :thirdShow="classShow" @handleFirst="handleFaculty"
                    @handleSecond="handleGrade" @handleThird="handleClass" :spaceBetween="true"></ChangeSelect>
            </div>
        </Card>
        <!-- 选择学部 -->
        <van-action-sheet v-model:show="facultyShow" teleport="#app" :actions="facultyActions" @select="selectFaculty"
            cancel-text="取消" description="请选择学部" close-on-click-action />
        <!-- 选择年级 -->
        <van-action-sheet v-model:show="gradeShow" teleport="#app" :actions="gradeActions" @select="selectGrade"
            cancel-text="取消" description="请选择年级" close-on-click-action />
        <!-- 选择班级 -->
        <van-action-sheet v-model:show="classShow" teleport="#app" :actions="classActions" @select="selectClass"
            cancel-text="取消" description="请选择班级" close-on-click-action />
        <!-- 列表 -->
        <div class="list-cont-box">
            <div class="top-checkall-box">
                <van-row class="color6">
                    <van-col :span="24" class="row">
                        <van-icon name="circle" size="18" color="#E8E8E8" />
                        <!-- <van-icon name="checked" size="18" color="#3D7FFF" /> -->
                        <span style="margin-left:10px;">全选</span>
                    </van-col>
                </van-row>
            </div>
            <Card :border="5" v-for="(item, index) in 8" :key="index">
                <van-cell is-link>
                    <template #title>
                        <van-icon name="circle" size="18" color="#E8E8E8" />
                        <!-- <van-icon name="checked" size="18" color="#3D7FFF" /> -->
                        <span class="cumton-title">2021级(01)班分数明细</span>
                    </template>
                </van-cell>
                <Button round type="danger" margin row>扣分</Button>
                <Button round type="success" margin row>加分</Button>
                <van-row justify="space-between">
                    <van-col :span="8" v-for="(item, index) in tabList" :key="index">
                        <div class="row-padding-box" :class="index == 0 ? 'left-col-box' : index == 2 ? 'right-col-box' : ''">
                            <div>{{ item }}</div>
                            <div>{{ index + 1 }}</div>
                        </div>
                    </van-col>
                </van-row>
            </Card>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { Toast } from 'vant'
import { ref, reactive, onMounted, nextTick, onUnmounted } from 'vue'
import $util from '../util/util'
import { useStore } from 'vuex'
import { useRoute, useRouter } from 'vue-router'
const store = useStore()
const dateList = ref(['今天', '本周', '本月', '本学期'])
const dateIndex = ref(1)
const checkDateBtn = (val: number) => {
    dateIndex.value = val
}
const tabList = ref(['卫生评分', '内务评分', '纪律评分'])
const facultyName = ref('选择学部')
const gradeName = ref('选择年级')
const className = ref('选择班级')
const facultyShow = ref(false)
const gradeShow = ref(false)
const classShow = ref(false)
const facultyActions = ref([{ name: "选项一" }, { name: "选项二" }, { name: "选项三" }])
const gradeActions = ref([{ name: "选项三" }, { name: "选项四" }, { name: "选项五" }])
const classActions = ref([{ name: "选项六" }, { name: "选项七" }, { name: "选项八" }])

const handleFaculty = () => {
    facultyShow.value = true
}
const selectFaculty = (item: any) => {
    facultyShow.value = false
    facultyName.value = item.name
}
const handleGrade = () => {
    if (facultyName.value === '选择学部') {
        return Toast('请先选择学部')
    }
    gradeShow.value = true
}
const selectGrade = (item: any) => {
    gradeShow.value = false
    gradeName.value = item.name
}
const handleClass = () => {
    if (gradeName.value === '选择年级') {
        return Toast('请先选择年级')
    }
    classShow.value = true
}
const selectClass = (item: any) => {
    classShow.value = false
    className.value = item.name
}
</script>
<style lang="scss" scoped>
.class-message-box {
    position: relative;

    .select-content-box {
        margin-top: 15px;
        border-top: 1px solid #F9F9F9;
        padding-top: 10px;
    }

    .list-cont-box {
        padding: 15px;

        .van-cell {
            padding: 0;
            display: flex;
            align-items: center;
            margin-bottom: 12px;
        }

        .van-cell:after {
            display: none;
        }

        .cumton-title {
            font-size: 16px;
            font-family: Bold;
            color: #649FFF;
            margin-left: 12px;
        }

        .row-padding-box {
            text-align: center;
            padding: 10px 0 0 0;
            color: #666666;
            display: flex;
            justify-content: center;

            div:first-of-type {
                // margin-bottom: 10px;
                color: #999999;
            }

            div:last-of-type {
                color: #333333;
                margin-left:5px;
            }
        }

        .left-col-box {
            display: flex;
            justify-content: flex-start;
        }

        .right-col-box {
            display: flex;
            justify-content: flex-end;
        }
    }
}
</style>
  